cmake_minimum_required(VERSION 2.8.3)
project(offboard)

add_definitions(-std=c++14 -g -O3 -ftree-vectorize -march=native)

find_package(catkin REQUIRED COMPONENTS
    roscpp
    rospy
    roslib
    std_msgs
    sensor_msgs
    geometry_msgs
    mavros_msgs
    nav_msgs
    message_generation
)

find_package(Eigen3 REQUIRED)

 add_message_files(
    FILES
    ControlCommand.msg
    DebugPID.msg
 )

generate_messages(
  DEPENDENCIES
  std_msgs
  geometry_msgs
)

catkin_package(
    CATKIN_DEPENDS roscpp std_msgs message_runtime
)

include_directories( 
    include 
    ${catkin_INCLUDE_DIRS}
    ${EIGEN3_INCLUDE_DIRS} 
)

add_executable(controller_node src/controller_node.cpp)
target_link_libraries(controller_node ${catkin_LIBRARIES})
add_dependencies(controller_node 
    ${${PROJECT_NAME}_EXPORTED_TARGETS} 
    ${catkin_EXPORTED_TARGETS})

add_executable(reveiveRC src/reveiveRC.cpp)
target_link_libraries(reveiveRC ${catkin_LIBRARIES})


# DEMO
add_executable(posctl_hover src/posctl_hover.cpp)
target_link_libraries(posctl_hover ${catkin_LIBRARIES})

add_executable(posctl_circle src/posctl_circle.cpp)
target_link_libraries(posctl_circle ${catkin_LIBRARIES})

add_executable(attctl_circle src/attctl_circle.cpp)
target_link_libraries(attctl_circle ${catkin_LIBRARIES})
add_dependencies(attctl_circle 
    ${${PROJECT_NAME}_EXPORTED_TARGETS} 
    ${catkin_EXPORTED_TARGETS})

add_executable(attctl_traj src/attctl_traj.cpp)
target_link_libraries(attctl_traj ${catkin_LIBRARIES} )
add_dependencies(attctl_traj 
    ${${PROJECT_NAME}_EXPORTED_TARGETS} 
    ${catkin_EXPORTED_TARGETS})

add_executable(traj src/traj.cpp)
target_link_libraries(traj ${catkin_LIBRARIES} )
add_dependencies(traj 
    ${${PROJECT_NAME}_EXPORTED_TARGETS} 
    ${catkin_EXPORTED_TARGETS})